<%@ page import="java.util.Random" %>
<%@ page import="java.io.PrintWriter" %>
<%@ page pageEncoding="utf-8" contentType="text/html; utf-8" %>
<%
//示例为4位数字验证码
Random rand = new Random();
Integer code = rand.nextInt(10000);
String sessionValidCode = String.format("%04d" , code);
out.print(sessionValidCode);
session.setAttribute("sessionValidCode" , sessionValidCode);
%>
